import pandas as pd
from pylab import mpl
mpl.rcParams['font.sans-serif']=['SimHei']
import matplotlib.pyplot as plt


data = pd.read_csv('地震数据3.csv')

data1 = pd.read_csv('地震数据3.csv',usecols=['M','LOCATION_C'])
top10_data = data1.sort_values(by = 'M',ascending = False).head(10)
top10_data.index = top10_data['LOCATION_C'] # 设置一个新的索引
top10_data.plot(kind = 'bar',title = '地震的top10',figsize = (20,8),grid = '-')
plt.savefig('地震等级图.png')
plt.show()